Merge duplicate tests
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 9 Jul 2017 10:10:24 +0000 (13:10 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 9 Jul 2017 10:10:24 +0000 (13:10 +0300)
tests/bad-config.rs
tests/build.rs

index d18d140073c4ee2398f9cc0d1ff365c3ff8e937f..cff576dbb4722866e3960ef76d26563f8f9f5e90 100644 (file)
@@ -610,7 +610,7 @@ have a single canonical source path irrespective of build target.
 
 #[test]
 fn unused_keys() {
-    let foo = project("foo")
+    let p = project("foo")
         .file("Cargo.toml", r#"
            [package]
            name = "foo"
@@ -622,14 +622,59 @@ fn unused_keys() {
         "#)
         .file("src/lib.rs", "");
 
-    assert_that(foo.cargo_process("build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0).with_stderr("\
 warning: unused manifest key: target.foo.bar
 [COMPILING] foo v0.1.0 (file:///[..])
 [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
+
+    let mut p = project("foo");
+    p = p
+        .file("Cargo.toml", r#"
+            [project]
+
+            name = "foo"
+            version = "0.5.0"
+            authors = ["wycats@example.com"]
+            bulid = "foo"
+        "#)
+        .file("src/lib.rs", r#"
+            pub fn foo() {}
+        "#);
+    assert_that(p.cargo_process("build"),
+                execs().with_status(0)
+                    .with_stderr("\
+warning: unused manifest key: project.bulid
+[COMPILING] foo [..]
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
+
+    let mut p = project("bar");
+    p = p
+        .file("Cargo.toml", r#"
+            [project]
+
+            name = "foo"
+            version = "0.5.0"
+            authors = ["wycats@example.com"]
+
+            [lib]
+            build = "foo"
+        "#)
+        .file("src/lib.rs", r#"
+            pub fn foo() {}
+        "#);
+    assert_that(p.cargo_process("build"),
+                execs().with_status(0)
+                    .with_stderr("\
+warning: unused manifest key: lib.build
+[COMPILING] foo [..]
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 "));
 }
 
+
 #[test]
 fn empty_dependencies() {
     let p = project("empty_deps")
index 9c97323a330330c39c492e07a4ebde1ed144a82a..9dfbbe7c32aa43ac7c26ba13f4229bf46e2162b3 100644 (file)
@@ -1046,59 +1046,6 @@ fn many_crate_types_correct() {
     assert_that(&p.root().join("target/debug").join(&fname), existing_file());
 }
 
-#[test]
-fn unused_keys() {
-    let mut p = project("foo");
-    p = p
-        .file("Cargo.toml", r#"
-            [project]
-
-            name = "foo"
-            version = "0.5.0"
-            authors = ["wycats@example.com"]
-            bulid = "foo"
-
-            [lib]
-            name = "foo"
-            path = "foo"
-        "#)
-        .file("src/foo.rs", r#"
-            pub fn foo() {}
-        "#);
-    assert_that(p.cargo_process("build"),
-                execs().with_status(0)
-                       .with_stderr("\
-warning: unused manifest key: project.bulid
-[COMPILING] foo [..]
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-"));
-
-    let mut p = project("bar");
-    p = p
-        .file("Cargo.toml", r#"
-            [project]
-
-            name = "foo"
-            version = "0.5.0"
-            authors = ["wycats@example.com"]
-
-            [lib]
-
-            name = "foo"
-            build = "foo"
-        "#)
-        .file("src/foo.rs", r#"
-            pub fn foo() {}
-        "#);
-    assert_that(p.cargo_process("build"),
-                execs().with_status(0)
-                       .with_stderr("\
-warning: unused manifest key: lib.build
-[COMPILING] foo [..]
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-"));
-}
-
 #[test]
 fn self_dependency() {
     let mut p = project("foo");